package com.weasel.weixin.commons.media.bean;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;

import java.io.File;

/**多媒体
 * Created by Dylan on 2015/9/29.
 */
public abstract class Media {

    final static String IMAGE = "image";
    final static String NEWS = "news";
    final static String VIDEO = "video";
    final static String VOICE = "voice";
    final static String THUMB = "thumb";
    final static String FILE = "file";

    private String type;

    private File file;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public File getFile() {
        return file;
    }

    public void setFile(File file) {
        this.file = file;
    }

    /*public boolean isSupport(){

        File file = getFile();
        if(null == file){
            return false;
        }
        long length = FileUtils.sizeOf(file);
        String name = StringUtils.lowerCase(file.getName());
        return length <= getSupportSize() && (StringUtils.endsWithAny(name, getSupportType()) || StringUtils.endsWithAny("*",getSupportType()));
    }

    public abstract long getSupportSize();

    public abstract String[] getSupportType();*/
}
